package javacore.dtypeopt.operator;

/**
 * Base on Listing 2-2. CreditCardTest.java
 */
public class ArrayEnumDemo {

	enum CreditCardType {
		VISA, MASTER_CARD, AMERICAN_EXPRESS
	};

	public static void main(String[] args) {
		/* Declaring a array */
		CreditCardType[] allMyCard = new CreditCardType[3];

		allMyCard[0] = CreditCardType.VISA;
		allMyCard[1] = CreditCardType.MASTER_CARD;
		allMyCard[2] = CreditCardType.AMERICAN_EXPRESS;

		/* Show all my card */
		for (int i = 0; i < allMyCard.length; i++)
			switch (allMyCard[i]) {
			case VISA:
				System.out.println("I have a VISA card !!!");
				break;
			case MASTER_CARD:
				System.out.println("I have a MASTER CARD card !!!");
				break;
			case AMERICAN_EXPRESS:
				System.out.println("I have a AMERICAN EXPRESS card !!!");
				break;
			default:
				System.out.println("I will never go here !!!");
				break;
			}
	}

}
